package ua.kyivenergo.cableLines.data.attributes;

import ua.kyivenergo.cableLines.data.GenericObject;

/**
 * Created by Alex Kebkalo (kebka@mail.ru) on 18.04.14.
 */
public class LinkAttribute extends Attribute {
    private GenericObject linkedObject;

    public LinkAttribute(String description, GenericObject linkedObject) {
        super(description);
        this.linkedObject = linkedObject;
    }

    @Override
    public int getAttributeType() {
        return AttributeTypes.LinkAttribute;
    }

    public GenericObject getValue() {
        return linkedObject;
    }

    @Override
    public double getRelevance(String searchString) {
        return linkedObject.getRelevance(searchString);
    }

    @Override
    public String toString() {
        return linkedObject.getAttributeText("name");
    }
}
